// Copyright 2022 Tencent
#pragma once
#include "json/json.h"
#include <fstream>
#include <string>

namespace net_tools::util
{
  class Json
  {
  public:
    Json();
    ~Json();
    bool Open_read(const std::string &address);
    bool Open_write(const std::string &address);
    void Json_write(::Json::Value *root);
    void Read_from_ifs(::Json::Value *root);

  private:
    std::ifstream *ifs_;
    std::ofstream *ofs_;
    ::Json::StreamWriter *write_;
    ::Json::CharReader *read_;
  };

} // namespace net_tools::util